#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<math.h>
int FourFlower(int x)
{
    int sum = 0;
    int temp_x = x;
    while (x > 0)
    {
        int temp = x % 10;
        sum += (int)pow(temp, 4);
        x /= 10;
    }
    if (sum == temp_x)
    {
        return 1;
    }
    else
    {
        return 0;
    }

}
int main()
{
    int left = 0;
    int right = 0;
    scanf("%d %d", &left, &right);
    int n = 0;
    for (n = left; n <= right; n++)
    {
        int ret = FourFlower(n);
        if (1 == ret)
        {
            printf("%d ", n);
        }
    }
    return 0;
}